/*
 *  Copyright 2009 David Kuhn <david.s.kuhn at gmail.com>.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 */
package com.google.code.teamtools.domain;

import java.util.List;

/**
 * @author David Kuhn
 *
 */
public interface IHasRoles
{
	/**
     * Adds a role to the person's list of roles. If this is the first role
     * to be added to the person then it will become the primary by
     * default.
     * 
     * @param role
     *            the role to add
     */
    void addRole(IRole role);

    /**
     * Adds a role to the person's list of roles and set it as the primary
     * role.
     * 
     * @param role
     *            the role to add as primary
     */
    void addRoleAsPrimary(IRole role);
    
    /**
     * Returns the primary role played by the person.
     * 
     * @return the primary role
     */
    IRole getPrimaryRole();
    
    /**
     * Return the list of roles played by the person.
     * 
     * @return a <tt>List</tt> of roles
     */
    List<IRole> getRoles();

    /**
     * Sets the primary role. Role must already exist (i.e. have been added to
     * the person) in order for it to be set as the primary role. If this
     * role hasn't already been added to the person consider using
     * {@link #addRoleAsPrimary(IRole)}.
     * 
     * @param role
     *            the role to set as primary
     * @see #addRoleAsPrimary(IRole)
     */
    void setPrimaryRole(IRole role);
}
